import Mock from 'mockjs'

// 模拟仪表盘数据
Mock.mock('/api/dashboard', 'get', () => {
  return {
    code: 200,
    data: {
      totalUsers: Mock.Random.integer(1000, 5000),
      totalOrders: Mock.Random.integer(5000, 20000),
      todayVisits: Mock.Random.integer(100, 1000),
      conversionRate: Mock.Random.float(1, 10, 2, 2)
    }
  }
})

// 模拟用户列表数据
Mock.mock('/api/users', 'get', () => {
  const users = Mock.mock({
    'list|10': [{
      'id|+1': 1,
      'name': '@cname',
      'username': '@username',
      'email': '@email',
      'status|1': ['active', 'inactive'],
      'createTime': '@datetime'
    }]
  })
  
  return {
    code: 200,
    data: users.list,
    total: 100
  }
})

export default Mock